<template>
<el-form ref="form" :model="form" label-width="100px">
  <el-form-item label-width="100px"  label="产品监测链接">
    <el-input type="textarea"  :rows="6"  v-model="dataForm.url"></el-input>
  </el-form-item>
  <el-form-item label-width="100px"  label="有效链接">
    <el-input type="textarea" :rows="6" v-model="dataForm.result"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="getValidLink">获取有效监测</el-button>
    <el-button type="success" @click="copyValidLink">复制有效监测</el-button>
  </el-form-item>

</el-form>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './reporttotal-add-or-update'
import Copy from 'copy-to-clipboard';
import { getDictDataList } from '@/utils'

export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/adx/reporttotal/ocpxTotal',
        getDataListIsPage: true,
        exportURL: '/adx/reporttotal/export',
        deleteURL: '/adx/reporttotal',
        deleteIsBatch: true
      },
      dspIdList: [],
      userNameList: [],
      businessList:[],
      isAgeVisible: false,
      mediaList:[],
      productList:[],
      dataForm: {
        url: '',
        result: ''
      }
    }
  },
  mounted() {

  },
  components: {
    AddOrUpdate
  },
  computed: {

  },
  methods: {
    getValidLink() {
     
      return this.$http.get('/base/common/getRealUrl',{params:this.dataForm}).then(({ data: res }) => {
        if (res.code !== 0) {
          return this.$message.error(res.msg)
        }
        this.dataForm.result=res.data;
      }).catch(() => { })

    },
    copyValidLink(){
      Copy(this.dataForm.result);  
      this.$message('监测链接生成成功，已复制在粘贴板')
    }
  }
}
</script>


